﻿/* 
 * Copyright (c) 2010 Letwory Interactive
 * All rights reserved.
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * -- Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * -- Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * Original contributor: Nathan Letwory
 */

using System;

namespace VerseSharp
{
    public class MaterialFragmentColor: IMaterialFragment
    {
        public FragmentType ID { get { return FragmentType.Color; } }
        public double R;
        public double G;
        public double B;

        public void Deserialize(byte[] source, ref int pos)
        {
            R = Utils.GetReal64(source, ref pos);
            G = Utils.GetReal64(source, ref pos);
            B = Utils.GetReal64(source, ref pos);
        }

        public void Serialize(byte[] destination, ref int pos)
        {
            Utils.PutReal64(destination, ref pos, R);
            Utils.PutReal64(destination, ref pos, G);
            Utils.PutReal64(destination, ref pos, B);
        }
    }
}
